<?php

include('../../include/functions.inc.php');
include('../../include/maintenance.inc.php');

if (!isset($_SESSION['mPolicy'])) {
    $maintenance = new Maintenance();

    $maintenance->windowTitle = 'Mantenimiento de Cargos por Carrera';
    $maintenance->newUrlPage = 'new.php';
    $maintenance->editUrlPage = 'edit.php';
    $maintenance->saveNewUrlPage = 'data.php?operation=s&FK_CAREER=' . getParam('CAREER');
    $maintenance->updateUrlPage = 'data.php?operation=u&FK_CAREER=' . getParam('CAREER');
    $maintenance->deleteUrlPage = 'data.php?operation=d';
    $maintenance->listJsonUrl = 'list.php?CAREER=' . getParam('CAREER');
    $maintenance->path = '../../';
    $maintenance->staticsUrl = 'index.php?statics=true';
    $maintenance->editUrlParams = array("ID" => "ID");
    $maintenance->deleteUrlParams = array("ID" => "ID");
    $maintenance->table = "cllg_charge_policy";
    $maintenance->urlBack = "../../modules/careers";
    $maintenance->validations = array("required,AMOUNT,Monto es Requerido",
        "required,FRECUENCY,Frecuencia es Requerida",
        "required,DAY_APPLY,Dia de cargo es Requerido",
        "required,COUNT,Numero de Cargos es Requerido",
        "digits_only,DAY_APPLY,Dia de cargo es Numerico",
        "idDouble,AMOUNT,Monto es Numerico",
        "function,validCount");
    $maintenance->aditionalScript = "functions.js.php";

    $_SESSION['mPolicy'] = serialize($maintenance);
} else {
    $maintenance = unserialize($_SESSION['mPolicy']);
    $maintenance->listJsonUrl = 'list.php?CAREER=' . getParam('CAREER');
    $maintenance->saveNewUrlPage = 'data.php?operation=s&FK_CAREER=' . getParam('CAREER');
    $maintenance->updateUrlPage = 'data.php?operation=u&FK_CAREER=' . getParam('CAREER');

    $_SESSION['mPolicy'] = serialize($maintenance);
}

if (!isEmpty(getParam('statics'))) {
    $maintenance->statics(count($db->query_select('cllg_charge_policy')));
} else {
    $maintenance->build();
}
?>